//
//  ActivityGoodsDetailViewController.m
//  Shengzhuli
//
//  Created by subook on 2017/9/13.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "ActivityGoodsDetailViewController.h"
#import "GoodsInfoCell.h"
#import "GoodsCountCell.h"
#import "AddressSelectCell.h"
#import "SDCycleScrollView.h"
#import "ShopingToolBar.h"
#import "LLSegmentedControl.h"
#import "SZLAccountHelper.h"
#import "SingleNetService.h"
#import "NormalGoodsDetailModel.h"
#import <UIImageView+WebCache.h>
#import "MBProgressHUD+MJ.h"
#import "SZLTabBarViewController.h"
#import "GoodsDetailmageCell.h"
#import "AnimationImageView.h"
#import "BuyCarsViewController.h"
#import "ReceiveAddressNetwork.h"
#import "SZLReceiveAddressViewController.h"
#import "TranstionCountView.h"
#import "CommitListCell.h"
#import <MJRefresh.h>
#import "NoCommentView.h"
#import "ConEditCardViewController.h"
#import "ActivityNetWork.h"
#import "MBProgressHUD+MJ.h"

@interface ActivityGoodsDetailViewController ()<UITableViewDataSource,UITableViewDelegate,ShopingToolBarDelegate,UIScrollViewDelegate,ShopingToolBarDelegate,AddressSelectCellDelegate,GoodsCountCellDelegate,TranstionCountViewDelegate,TranstionCountViewDelegate,UIAlertViewDelegate>

@property (nonatomic,weak) UIScrollView *scroll;
@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) UITableView *detailTableView;
@property (nonatomic,strong) UITableView *commentTableView;
@property (nonatomic,weak) UIView *headView;
@property (nonatomic,strong) NSMutableArray *comments;

@property (nonatomic,weak) LLSegmentedControl *segmentedControl;
@property (nonatomic,weak) SDCycleScrollView *roolView;
@property (nonatomic,strong) ShopingToolBar *toolBar;
@property (nonatomic,strong) AddGoodsModel *gooodsModel;//详情
@property (nonatomic,strong) AddressModel *addressModel;//默认收货地址
@property (nonatomic,strong) AnimationImageView *animtaionImageView;
@property (nonatomic,strong) TranstionCountView *transtionView;//选择数量
@property (nonatomic,weak) UILabel *countLab;//数量lab
@property (nonatomic,assign) NSInteger selectCount;//数量lab
@property (nonatomic,assign) NSInteger commentPage;
@property (nonatomic,strong) NoCommentView *noCommentView;
//全部评论数量
@property (nonatomic,strong) UILabel *allLab;
@property (nonatomic, assign)NSInteger addID;
@end

@implementation ActivityGoodsDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.selectCount = 1;
    self.commentPage = 1;
    self.addID = @"1";
    [self setSegmentController];
    [self setTableViews];
    [self setRoolView];
    [self setToolBar];
    [self getGoodsDetail];
    //[self getCommentList];
    if ([SZLAccountHelper isAlreadyLogin]) {
        [self getDefaultAddress];
    }
}
- (void)setSegmentController
{
    LLSegmentedControl *segmentedControl = [[LLSegmentedControl alloc] initWithFrame:CGRectMake(0, 0, 180, 43)];
    segmentedControl.titleArray = @[@"商品", @"详情"];
    segmentedControl.backgroundColor = [UIColor clearColor];
    segmentedControl.segmentedControlLineStyle = LLSegmentedControlStyleUnderline;
    segmentedControl.segmentedControlTitleSpacingStyle = LLSegmentedControlTitleSpacingStyleWidthAutoFit;
    // lineWidthEqualToTextWidth 设置为YES, lineWidth 属性则不需设置
    segmentedControl.lineWidthEqualToTextWidth = YES;
    segmentedControl.textColor = [UIColor whiteColor];
    segmentedControl.selectedTextColor = [UIColor whiteColor];
    segmentedControl.lineColor = [UIColor whiteColor];
    segmentedControl.font = [UIFont systemFontOfSize:14];
    segmentedControl.selectedFont = [UIFont boldSystemFontOfSize:15];
    segmentedControl.lineHeight = 2.f;
    segmentedControl.titleSpacing = 50;
    segmentedControl.defaultSelectedIndex = 0;
    self.segmentedControl = segmentedControl;
    self.navigationItem.titleView = segmentedControl;
    __WEAK
    [segmentedControl segmentedControlSelectedWithBlock:^(LLSegmentedControl *segmentedControl, NSInteger selectedIndex) {
        weakSelf.scroll.contentOffset = CGPointMake(ScreenW*selectedIndex, 0);
    }];
}
- (void)setTableViews
{
    UIScrollView *scroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenW,ScreenH-64)];
    scroll.contentSize = CGSizeMake(ScreenW*2, 0);
    scroll.pagingEnabled = YES;
    scroll.delegate = self;
    [self.view addSubview:scroll];
    self.scroll = scroll;
    
    [scroll addSubview:self.tableView];
    [scroll addSubview:self.detailTableView];
    [scroll addSubview:self.commentTableView];
}
- (void)setRoolView
{
    SDCycleScrollView *roolView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, ScreenW, ScreenW) delegate:nil placeholderImage:[UIImage imageNamed:@"default_large_goods_image"]];
    roolView.pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
    roolView.autoScrollTimeInterval = 3.0f;
    roolView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
    self.tableView.tableHeaderView = roolView;
    self.roolView = roolView;
    roolView.clickItemOperationBlock = ^(NSInteger count){//轮播图跳转
        
    };
}
- (void)setToolBar
{
    NSArray *titles = titles = @[@"关注",@"购物车",@"加入购物车"];
    ShopingToolBar *toolBar = [ShopingToolBar shopToolBarWithTitles:titles];
    toolBar.delegate = self;
    self.toolBar = toolBar;
    [self.view addSubview:toolBar];
    
}
#pragma mark ------ShopingToolBarDelegate-----------
- (void)shopingToolBarClick:(ShopingToolBarType)type btn:(UIButton *)btn
{
    if ([SZLAccountHelper shouldLogin]) return;
    __WEAK
    switch (type) {
//        case ShopingToolBarTypeService:
//        {
//            if ([[SZLAccountHelper shareInstance].mobilePhone isEqualToString:self.gooodsModel.shopMobilePhone]) {
//                [MBProgressHUD showError:@"商家不能和自己聊天"];
//                return;
//            }
//            ConEditCardViewController *cardVc = [[ConEditCardViewController alloc]init];
//            cardVc.type = EditTypeChatWithSeller;
//            cardVc.ID = [self.gooodsModel.shopId integerValue];
//            [self.navigationController pushViewController:cardVc animated:YES];
//        }
//            break;
//        case ShopingToolBarTypeFocuse:
//        {
//            [self addFocus:btn];
//        }
            break;
        case ShopingToolBarTypeBuyCar:
        {
            BuyCarsViewController *carVc = [[BuyCarsViewController alloc]init];
            carVc.countChangedBlock = ^{
                [weakSelf getGoodsDetail];
            };
            [self.navigationController pushViewController:carVc animated:YES];
        }
            break;
        case ShopingToolBarTypeAdd:
        {
            [self addBuyCar];
        }
            break;
        case ShopingToolBarTypeExchange:
        {
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"是否兑换该商品" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
            [alertView show];
            
        }
            break;
        default:
            break;
    }
}
#pragma mark - alertview delegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    
    switch (buttonIndex) {
        case 0:{
            
        }
            break;
        case 1:{
            /*
             productNo 商品单号          productCount  购买数量         receiveAddressId  地址id             token 唯一标识
             */
            
            NSMutableDictionary *param = [NSMutableDictionary dictionary];
            param[@"token"] = [SZLAccountHelper shareInstance].token;
            param[@"productNo"] = self.productNo;
            param[@"receiveAddressId"] = [NSString stringWithFormat:@"%ld",(long)self.addressModel.ID];
            
            param[@"productCount"] = [NSString stringWithFormat:@"%ld",(long)self.selectCount];
            NSLog(@"token = %@ /n productNo = %@/n id = %@ count = %@",param[@"token"],self.productNo,self.addressModel.receiveAddress,param[@"productCount"]);
            _addID = self.addressModel.ID;
            if (_addID && _addID!=0) {
                [ActivityNetWork getActivityExchangeGoodsWithParame:param response:^(BOOL success, NSString *msg, NSString *errorCode, AddGoodsModel *gooodsModel) {
                    if (success) {
                        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"兑换成功 请到'兑换商品-兑换清单中查看'" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [alertView show];
                    }else {
                        NSLog(@"%@",msg);
                        [MBProgressHUD showError:msg toView:self.view];
                    }
                    
                }];
                
            }else {
                [MBProgressHUD showError:@"请填写收货地址" toView:self.view];
            }
            
            
        }
            break;
        default:
            break;
    }
}
#pragma mark - Table view data delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView == self.tableView) {
        return 44;
    }else if (tableView == self.detailTableView){
        UIImage *image = [[[SDWebImageManager sharedManager] imageCache] imageFromDiskCacheForKey:self.gooodsModel.productDetailList[indexPath.row]];
        float height = 0;
        if (image) {
            height = image.size.height*ScreenW/image.size.width;
        }
        return height;
    }
    return 100;
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    if (tableView == self.tableView) {
        return 3;
    }else if (tableView == self.detailTableView){
        return 1;
    }
    return self.comments.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (tableView == self.tableView) {
        return 1;
    }else if (tableView == self.detailTableView){
        return self.gooodsModel.productDetailList.count;
    }
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView == self.tableView) {
        if (indexPath.section == 0) {
            GoodsInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([GoodsInfoCell class])];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.gooodsModel = self.gooodsModel;
            cell.type = @"1";
            return cell;
        }else if (indexPath.section == 1){
            GoodsCountCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([GoodsCountCell class])];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.countChooseButton.hidden = YES;
            cell.delegate = self;
            return cell;
        }
        AddressSelectCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([AddressSelectCell class])];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.goodsModel = self.gooodsModel;
        cell.addressModel = self.addressModel;
        cell.delegate = self;
        return cell;
    }else if (tableView == self.detailTableView){
        GoodsDetailmageCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([GoodsDetailmageCell class])];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.imageStr = self.gooodsModel.productDetailList[indexPath.row];
        return cell;
    }
    CommitListCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([CommitListCell class])];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.model = self.comments[indexPath.section];
    return cell;
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    if (scrollView == self.scroll) {
        [self.segmentedControl segmentedControlSetSelectedIndex:(NSInteger)scrollView.contentOffset.x/ScreenW];
    }
}
#pragma mark ------------GoodsCountCellDelegate---------------------
- (void)goodsCountCellClick:(UILabel *)countLab
{
    TranstionCountView *view = [TranstionCountView shareTranstionView];
    view.frame = CGRectMake(0, 0, ScreenW, ScreenH);
    [[UIApplication sharedApplication].keyWindow addSubview:view];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [view doAnimation];
    });
    view.gooodsModel = self.gooodsModel;
    view.delegate = self;
    self.transtionView = view;
    self.countLab = countLab;
}
#pragma mark ------------TranstionCountViewDelegate---------------------
- (void)TranstionCountViewSureClick:(NSInteger)count
{
    self.countLab.text = [NSString stringWithFormat:@"%zd个",count];\
    self.selectCount = count;
}
#pragma mark ------------AddressSelectCellDelegate---------------------
- (void)addressSelectCellSelect
{
    SZLReceiveAddressViewController *addressVc = [[SZLReceiveAddressViewController alloc]init];
    addressVc.type = AddressTypeSelect;
    __WEAK
    addressVc.selectBlock = ^(AddressModel *model) {
        weakSelf.addressModel = model;
        [weakSelf.tableView reloadSections:[NSIndexSet indexSetWithIndex:2] withRowAnimation:UITableViewRowAnimationLeft];
    };
    [self.navigationController pushViewController:addressVc animated:YES];
}
#pragma mark ------网络请求-----------------
- (void)getGoodsDetail
{
    NSMutableDictionary *parame = [NSMutableDictionary dictionary];
    parame[@"productNo"] = self.productNo;
    NSLog(@"productnum = %@",self.productNo);
    if ([SZLAccountHelper isAlreadyLogin]) {
        parame[@"token"] = [SZLAccountHelper shareInstance].token;
    }
    __WEAK
    [self showClearBgWaiter];
    [ActivityNetWork getActivityGoodsDetailWithParame:parame response:^(BOOL success, NSString *msg,NSString *errorCode, AddGoodsModel *gooodsModel) {
        if (success) {
            //全部评论
            self.allLab.text = [NSString stringWithFormat:@"全部(%zd)",gooodsModel.commentNum];
            weakSelf.gooodsModel = gooodsModel;
            weakSelf.roolView.imageURLStringsGroup = gooodsModel.productBannerList;
            [weakSelf.tableView reloadData];
            //下载图片计算图片的高度
            [weakSelf calculateImagesHeight:gooodsModel.productDetailList];
            weakSelf.toolBar.gooodsModel = weakSelf.gooodsModel;
        }else{
            [self hideWaiter];
            [MBProgressHUD showError:msg toView:self.view];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                if ([errorCode isEqualToString:NoLoginStatus]) {
                    [self.navigationController popToRootViewControllerAnimated:YES];
                    SZLTabBarViewController *barVc = (SZLTabBarViewController*)[UIApplication sharedApplication].keyWindow.rootViewController;
                    barVc.selectedIndex = 0;
                    [SZLAccountHelper clearAlreadyInfo];
                    [SZLAccountHelper shouldLogin];
                }
            });
        }
    }];
}
//获取默认收货地址
- (void)getDefaultAddress
{
    NSMutableDictionary *parame = [NSMutableDictionary dictionary];
    parame[@"token"] = [SZLAccountHelper shareInstance].token;
    [self showWaiter];
    [ReceiveAddressNetwork getDefaultAddressWithParame:parame response:^(BOOL success, NSString *msg, AddressModel *model) {
        [self hideWaiter];
        self.addressModel = model;
        [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:2] withRowAnimation:UITableViewRowAnimationLeft];
    }];
}
- (void)addFocus:(UIButton *)btn
{
    NSMutableDictionary *parame = [NSMutableDictionary dictionary];
    parame[@"token"] = [SZLAccountHelper shareInstance].token;
    parame[@"productNo"] = self.productNo;
    [SingleNetService addFocusParame:parame response:^(BOOL success, NSString *msg) {
        if (success) {
            if (self.cancelBlock) {
                self.cancelBlock(YES);
            }
        }
        if (success&&btn.selected) {
            [self showOnlyText:@"关注成功"];
        }else if (success&&!btn.selected){
            [self showOnlyText:@"取消关注成功"];
        }
    }];
}
- (void)addBuyCar
{
    NSMutableDictionary *parame = [NSMutableDictionary dictionary];
    parame[@"token"] = [SZLAccountHelper shareInstance].token;
    parame[@"productNo"] = self.productNo;
    parame[@"count"] = @(self.selectCount);
    [self showClearBgWaiter];
    [SingleNetService addBuyCarParame:parame response:^(BOOL success, NSString *msg) {
        [self hideWaiter];
        if (success) {
            [self.animtaionImageView sd_setImageWithURL:[NSURL URLWithString:self.gooodsModel.thumbnailUrl] placeholderImage:GetImage(@"default_goods_image")];
            [self.view addSubview:self.animtaionImageView];
            self.animtaionImageView.hidden = NO;
            [self.animtaionImageView doAddBuyCarAnimationWithDelegate:self];
        }else{
            [MBProgressHUD showError:msg toView:self.view];
        }
    }];
}
- (void)getCommentList
{
    NSMutableDictionary *parame = [NSMutableDictionary dictionary];
    parame[@"productNo"] = self.productNo;
    parame[@"pageNo"] = @(self.commentPage);
    [self showClearBgWaiter];
    [SingleNetService getCommentsWithParame:parame response:^(BOOL success, NSString *msg, NSArray *lists) {
        [self hideWaiter];
        self.commentTableView.mj_footer.hidden = lists.count<20?YES:NO;
        if (self.noCommentView.superview) {
            [self.noCommentView removeFromSuperview];
        }
        if (success) {
            if (self.commentPage == 1) {
                if (lists.count == 0) {
                    [self.commentTableView addSubview:self.noCommentView];
                    return ;
                }
            }
            [self.comments addObjectsFromArray:lists];
            [self.commentTableView reloadData];
        }else{
            [MBProgressHUD showError:msg toView:self.view];
        }
    }];
}
#pragma mark ---animtaionImageView动画完成代理  改变购物车数量
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
    if (flag) {
        self.animtaionImageView.isAnimation = NO;//动画完成添加成功
        self.animtaionImageView.hidden = YES;
        [[NSNotificationCenter defaultCenter]postNotificationName:BuyCarAddNotifation object:nil userInfo:@{@"count":@(self.selectCount)}];
    }
}

//缓存图片计算图片高度
- (void)calculateImagesHeight:(NSArray *)arr
{
    __WEAK
    dispatch_group_t group = dispatch_group_create();
    for (NSString *imageStr in arr) {
        dispatch_group_enter(group);
        [[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:imageStr] options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
            dispatch_group_leave(group);
        }];
    }
    dispatch_group_notify(group, dispatch_get_main_queue(), ^{
        [weakSelf hideWaiter];//下载完图片在隐藏指示器
        [weakSelf.detailTableView reloadData];
    });
}
- (AnimationImageView *)animtaionImageView
{
    if (!_animtaionImageView) {
        _animtaionImageView = [[AnimationImageView alloc]initWithFrame:CGRectMake(ScreenW-0.175*ScreenW, ScreenH-64-40, 30, 30)];
        _animtaionImageView.image = GetImage(@"购物车_h");
    }
    return _animtaionImageView;
}
- (UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenW,ScreenH-64) style:UITableViewStyleGrouped];
        _tableView.dataSource = self;
        //    tableView.delegate = self;
        _tableView.contentInset = UIEdgeInsetsMake(0, 0, 49, 0);
        _tableView.sectionFooterHeight = 0.01;
        _tableView.sectionHeaderHeight = 10;
        _tableView.rowHeight = UITableViewAutomaticDimension;
        _tableView.estimatedRowHeight = 100;
        [_tableView registerNib:[UINib nibWithNibName:NSStringFromClass([GoodsInfoCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([GoodsInfoCell class])];
        [_tableView registerNib:[UINib nibWithNibName:NSStringFromClass([GoodsCountCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([GoodsCountCell class])];
        [_tableView registerNib:[UINib nibWithNibName:NSStringFromClass([AddressSelectCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([AddressSelectCell class])];
    }
    return _tableView;
}
- (UITableView *)detailTableView
{
    if (!_detailTableView) {
        _detailTableView = [[UITableView alloc]initWithFrame:CGRectMake(ScreenW, 0, ScreenW,ScreenH-64)];
        _detailTableView.dataSource = self;
        _detailTableView.delegate = self;
        _detailTableView.contentInset = UIEdgeInsetsMake(0, 0, 49, 0);
        _detailTableView.tableFooterView = [[UIView alloc]init];
        [_detailTableView registerNib:[UINib nibWithNibName:NSStringFromClass([GoodsDetailmageCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([GoodsDetailmageCell class])];
    }
    return _detailTableView;
}
/*
- (UITableView *)commentTableView
{
    if (!_commentTableView) {
        _commentTableView = [[UITableView alloc]initWithFrame:CGRectMake(ScreenW*2, 0, ScreenW,ScreenH-64)];
        _commentTableView.dataSource = self;
        _commentTableView.contentInset = UIEdgeInsetsMake(0, 0, 49, 0);
        _commentTableView.rowHeight = UITableViewAutomaticDimension;
        _commentTableView.estimatedRowHeight = 100;
        _commentTableView.tableFooterView = [[UIView alloc]init];
        _commentTableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
            self.commentPage++;
            [self getCommentList];
        }];
        UIView *headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenW, 50)];
        headView.backgroundColor = [UIColor whiteColor];
        UILabel *allLab = [[UILabel alloc]initWithFrame:CGRectMake(15, 10, 100, 30)];
        allLab.backgroundColor = [UIColor redColor];
        allLab.textColor = [UIColor whiteColor];
        allLab.textAlignment = NSTextAlignmentCenter;
        allLab.layer.cornerRadius = 5.0;
        allLab.clipsToBounds = YES;
        allLab.text = @" 全部(0) ";
        self.allLab = allLab;
        [headView addSubview:allLab];
        UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 49, ScreenW, 1)];
        lineView.backgroundColor = RGBColorOne(240);
        [headView addSubview:lineView];
        self.headView = headView;
        _commentTableView.tableHeaderView = headView;
        [_commentTableView registerNib:[UINib nibWithNibName:NSStringFromClass([CommitListCell class]) bundle:nil] forCellReuseIdentifier:NSStringFromClass([CommitListCell class])];
    }
    return _commentTableView;
}
 */
- (NSMutableArray *)comments
{
    if (!_comments) {
        _comments = [NSMutableArray array];
    }
    return _comments;
}
- (NoCommentView *)noCommentView
{
    if (!_noCommentView) {
        _noCommentView = [NoCommentView noCommentView];
        _noCommentView.frame = CGRectMake((ScreenW-80)/2.0, (ScreenH-64-49)*0.5-80, 80, 160);
    }
    return _noCommentView;
}

@end

